module WegoLint
  module DSL
    module RuleDirectives
      @@collapse_quotes = false
      @@collapse_hashes = false

      def included(klass)
        @@pattern = nil
      end

      def pattern(pattern = nil)
        @@pattern = pattern if pattern
        @@pattern
      end

      def collapse_quotes
        @@collapse_quotes = true
      end

      def collapse_quotes?
        @@collapse_quotes
      end

      def collapse_hashes
        @@collapse_hashes = true
      end

      def collapse_hashes?
        @@collapse_hashes
      end

    end

    def language(name, &block)
      WegoLint::RuleRegistry.instance.language_context = name
      yield
      WegoLint::RuleRegistry.instance.language_context = :general
    end

    def rule(description, &rule_block)
      rule = WegoLint::RuleRegistry.instance.add_rule(description, rule_block)
      rule
    end
  end
end

extend WegoLint::DSL
